#include <vector>
#include <iostream>
#include <cassert>
#include <cstring>
using namespace std;

class Solution 
{

public:
	bool isValidSudoku(vector<vector<char> > &board) 
	{
		// Start typing your C/C++ solution below
		// DO NOT write int main() function
		if(board.size() != 9)
			return false;

		bool ind[9];
		for(size_t i=0;i<9;i++)
		{
			memset(ind,0,sizeof(ind));
			for(size_t j=0;j<9;j++)
			{
				if(board[i][j] == '.')
					continue;
				int idx = board[i][j]-'1'; 
				if(ind[idx])
					return false;
				ind[idx] = true;
			}
		}

		for(size_t i=0;i<9;i++)
		{
			memset(ind,0,sizeof(ind));
			for(size_t j=0;j<9;j++)
			{
				if(board[j][i] == '.')
					continue;
				int idx = board[j][i]-'1'; 
				if(ind[idx])
					return false;
				ind[idx] = true;
			}
		}

		for(size_t i=0;i<9;i++)
		{
			memset(ind,0,sizeof(ind));
			size_t sx = 3*(i/3), sy = 3*(i%3);
			for(size_t j=0;j<9;j++)
			{
				size_t x = sx+j/3, y = sy + j%3;
				if(board[x][y] == '.')
					continue;
				int idx = board[x][y]-'1'; 
				if(ind[idx])
					return false;
				ind[idx] = true;
			}
		}

		return true;
	}
};


int main()
{

}

